package com.ruoyi.project.qyxy.jlscoredtl.controller;

import java.util.List;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.framework.aspectj.lang.annotation.Log;
import com.ruoyi.framework.aspectj.lang.enums.BusinessType;
import com.ruoyi.project.qyxy.jlscoredtl.domain.JlOrgScoreDetail;
import com.ruoyi.project.qyxy.jlscoredtl.service.IJlOrgScoreDetailService;
import com.ruoyi.framework.web.controller.BaseController;
import com.ruoyi.framework.web.domain.AjaxResult;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.framework.web.page.TableDataInfo;

/**
 * 监理得分详细Controller
 * 
 * @author lcl
 * @date 2021-03-14
 */
@RestController
@RequestMapping("/qyxy/jlscoredtl")
public class JlOrgScoreDetailController extends BaseController
{
    @Autowired
    private IJlOrgScoreDetailService jlOrgScoreDetailService;

    /**
     * 查询监理得分详细列表
     */
    @PreAuthorize("@ss.hasPermi('qyxy:jlscoredtl:list')")
    @GetMapping("/list")
    public TableDataInfo list(JlOrgScoreDetail jlOrgScoreDetail)
    {
        startPage();
        List<JlOrgScoreDetail> list = jlOrgScoreDetailService.selectJlOrgScoreDetailList(jlOrgScoreDetail);
        return getDataTable(list);
    }

    /**
     * 导出监理得分详细列表
     */
    @PreAuthorize("@ss.hasPermi('qyxy:jlscoredtl:export')")
    @Log(title = "监理得分详细", businessType = BusinessType.EXPORT)
    @GetMapping("/export")
    public AjaxResult export(JlOrgScoreDetail jlOrgScoreDetail)
    {
        List<JlOrgScoreDetail> list = jlOrgScoreDetailService.selectJlOrgScoreDetailList(jlOrgScoreDetail);
        ExcelUtil<JlOrgScoreDetail> util = new ExcelUtil<JlOrgScoreDetail>(JlOrgScoreDetail.class);
        return util.exportExcel(list, "jlscoredtl");
    }

    /**
     * 获取监理得分详细详细信息
     */
    @PreAuthorize("@ss.hasPermi('qyxy:jlscoredtl:query')")
    @GetMapping(value = "/{jlId}")
    public AjaxResult getInfo(@PathVariable("jlId") Long jlId)
    {
        return AjaxResult.success(jlOrgScoreDetailService.selectJlOrgScoreDetailById(jlId));
    }

    /**
     * 新增监理得分详细
     */
    @PreAuthorize("@ss.hasPermi('qyxy:jlscoredtl:add')")
    @Log(title = "监理得分详细", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody JlOrgScoreDetail jlOrgScoreDetail)
    {
        return toAjax(jlOrgScoreDetailService.insertJlOrgScoreDetail(jlOrgScoreDetail));
    }

    /**
     * 修改监理得分详细
     */
    @PreAuthorize("@ss.hasPermi('qyxy:jlscoredtl:edit')")
    @Log(title = "监理得分详细", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody JlOrgScoreDetail jlOrgScoreDetail)
    {
        return toAjax(jlOrgScoreDetailService.updateJlOrgScoreDetail(jlOrgScoreDetail));
    }

    /**
     * 删除监理得分详细
     */
    @PreAuthorize("@ss.hasPermi('qyxy:jlscoredtl:remove')")
    @Log(title = "监理得分详细", businessType = BusinessType.DELETE)
	@DeleteMapping("/{jlIds}")
    public AjaxResult remove(@PathVariable Long[] jlIds)
    {
        return toAjax(jlOrgScoreDetailService.deleteJlOrgScoreDetailByIds(jlIds));
    }
}
